3.23 \(\int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=134 \[ \frac{a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac{4 a^3 (B+i A) \log (\sin (c+d x))}{d}-\frac{(3 B+5 i A) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+4 a^3 x (A-i B)-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d} \]

[Out]

4*a^3*(A - I*B)*x + (a^3*(17*A - (15*I)*B)*Cot[c + d*x])/(6*d) - (4*a^3*(I*A + B)*Log[Sin[c + d*x]])/d - (a*A*
Cot[c + d*x]^3*(a + I*a*Tan[c + d*x])^2)/(3*d) - (((5*I)*A + 3*B)*Cot[c + d*x]^2*(a^3 + I*a^3*Tan[c + d*x]))/(
6*d)

________________________________________________________________________________________

Rubi [A]  time = 0.364967, antiderivative size = 134, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 34, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.118, Rules used = {3593, 3591, 3531, 3475} \[ \frac{a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac{4 a^3 (B+i A) \log (\sin (c+d x))}{d}-\frac{(3 B+5 i A) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+4 a^3 x (A-i B)-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

4*a^3*(A - I*B)*x + (a^3*(17*A - (15*I)*B)*Cot[c + d*x])/(6*d) - (4*a^3*(I*A + B)*Log[Sin[c + d*x]])/d - (a*A*
Cot[c + d*x]^3*(a + I*a*Tan[c + d*x])^2)/(3*d) - (((5*I)*A + 3*B)*Cot[c + d*x]^2*(a^3 + I*a^3*Tan[c + d*x]))/(
6*d)

Rule 3593

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[(a^2*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^
(n + 1))/(d*f*(b*c + a*d)*(n + 1)), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c +
 d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m -
 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && EqQ
[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rule 3591

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((b*c - a*d)*(A*b - a*B)*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2
 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*
c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx &=-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}+\frac{1}{3} \int \cot ^3(c+d x) (a+i a \tan (c+d x))^2 (a (5 i A+3 B)-a (A-3 i B) \tan (c+d x)) \, dx\\ &=-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac{(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+\frac{1}{6} \int \cot ^2(c+d x) (a+i a \tan (c+d x)) \left (-a^2 (17 A-15 i B)-a^2 (7 i A+9 B) \tan (c+d x)\right ) \, dx\\ &=\frac{a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac{(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+\frac{1}{6} \int \cot (c+d x) \left (-24 a^3 (i A+B)+24 a^3 (A-i B) \tan (c+d x)\right ) \, dx\\ &=4 a^3 (A-i B) x+\frac{a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac{(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}-\left (4 a^3 (i A+B)\right ) \int \cot (c+d x) \, dx\\ &=4 a^3 (A-i B) x+\frac{a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac{4 a^3 (i A+B) \log (\sin (c+d x))}{d}-\frac{a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac{(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}\\ \end{align*}

Mathematica [B]  time = 4.68382, size = 442, normalized size = 3.3 \[ \frac{a^3 \csc \left (\frac{c}{2}\right ) \sec \left (\frac{c}{2}\right ) \csc ^3(c+d x) (\cos (3 d x)+i \sin (3 d x)) \left (-48 (A-i B) \sin (c) \sin ^3(c+d x) \tan ^{-1}(\tan (4 c+d x))+\cos (d x) \left ((-9 B-9 i A) \log \left (\sin ^2(c+d x)\right )+36 A d x-9 i A-36 i B d x-3 B\right )-15 A \sin (2 c+d x)+13 A \sin (2 c+3 d x)+9 i A \cos (2 c+d x)-36 A d x \cos (2 c+d x)-12 A d x \cos (2 c+3 d x)+12 A d x \cos (4 c+3 d x)+9 i A \cos (2 c+d x) \log \left (\sin ^2(c+d x)\right )+3 i A \cos (2 c+3 d x) \log \left (\sin ^2(c+d x)\right )-3 i A \cos (4 c+3 d x) \log \left (\sin ^2(c+d x)\right )-24 A \sin (d x)+9 i B \sin (2 c+d x)-9 i B \sin (2 c+3 d x)+3 B \cos (2 c+d x)+36 i B d x \cos (2 c+d x)+12 i B d x \cos (2 c+3 d x)-12 i B d x \cos (4 c+3 d x)+9 B \cos (2 c+d x) \log \left (\sin ^2(c+d x)\right )+3 B \cos (2 c+3 d x) \log \left (\sin ^2(c+d x)\right )-3 B \cos (4 c+3 d x) \log \left (\sin ^2(c+d x)\right )+18 i B \sin (d x)\right )}{24 d (\cos (d x)+i \sin (d x))^3} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

(a^3*Csc[c/2]*Csc[c + d*x]^3*Sec[c/2]*(Cos[3*d*x] + I*Sin[3*d*x])*((9*I)*A*Cos[2*c + d*x] + 3*B*Cos[2*c + d*x]
 - 36*A*d*x*Cos[2*c + d*x] + (36*I)*B*d*x*Cos[2*c + d*x] - 12*A*d*x*Cos[2*c + 3*d*x] + (12*I)*B*d*x*Cos[2*c +
3*d*x] + 12*A*d*x*Cos[4*c + 3*d*x] - (12*I)*B*d*x*Cos[4*c + 3*d*x] + (9*I)*A*Cos[2*c + d*x]*Log[Sin[c + d*x]^2
] + 9*B*Cos[2*c + d*x]*Log[Sin[c + d*x]^2] + (3*I)*A*Cos[2*c + 3*d*x]*Log[Sin[c + d*x]^2] + 3*B*Cos[2*c + 3*d*
x]*Log[Sin[c + d*x]^2] - (3*I)*A*Cos[4*c + 3*d*x]*Log[Sin[c + d*x]^2] - 3*B*Cos[4*c + 3*d*x]*Log[Sin[c + d*x]^
2] + Cos[d*x]*((-9*I)*A - 3*B + 36*A*d*x - (36*I)*B*d*x + ((-9*I)*A - 9*B)*Log[Sin[c + d*x]^2]) - 24*A*Sin[d*x
] + (18*I)*B*Sin[d*x] - 48*(A - I*B)*ArcTan[Tan[4*c + d*x]]*Sin[c]*Sin[c + d*x]^3 - 15*A*Sin[2*c + d*x] + (9*I
)*B*Sin[2*c + d*x] + 13*A*Sin[2*c + 3*d*x] - (9*I)*B*Sin[2*c + 3*d*x]))/(24*d*(Cos[d*x] + I*Sin[d*x])^3)

________________________________________________________________________________________

Maple [A]  time = 0.071, size = 154, normalized size = 1.2 \begin{align*}{\frac{-3\,iB\cot \left ( dx+c \right ){a}^{3}}{d}}-{\frac{{\frac{3\,i}{2}}A{a}^{3} \left ( \cot \left ( dx+c \right ) \right ) ^{2}}{d}}-{\frac{4\,iB{a}^{3}c}{d}}+4\,A{a}^{3}x+4\,{\frac{A\cot \left ( dx+c \right ){a}^{3}}{d}}+4\,{\frac{A{a}^{3}c}{d}}-4\,{\frac{B{a}^{3}\ln \left ( \sin \left ( dx+c \right ) \right ) }{d}}-4\,iBx{a}^{3}-{\frac{4\,iA{a}^{3}\ln \left ( \sin \left ( dx+c \right ) \right ) }{d}}-{\frac{A{a}^{3} \left ( \cot \left ( dx+c \right ) \right ) ^{3}}{3\,d}}-{\frac{B{a}^{3} \left ( \cot \left ( dx+c \right ) \right ) ^{2}}{2\,d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x)

[Out]

-3*I/d*B*cot(d*x+c)*a^3-3/2*I/d*A*a^3*cot(d*x+c)^2-4*I/d*B*a^3*c+4*A*a^3*x+4/d*A*cot(d*x+c)*a^3+4/d*A*a^3*c-4/
d*B*a^3*ln(sin(d*x+c))-4*I*B*x*a^3-4*I/d*A*a^3*ln(sin(d*x+c))-1/3/d*A*a^3*cot(d*x+c)^3-1/2/d*B*a^3*cot(d*x+c)^
2

________________________________________________________________________________________

Maxima [A]  time = 2.37918, size = 157, normalized size = 1.17 \begin{align*} \frac{6 \,{\left (d x + c\right )}{\left (4 \, A - 4 i \, B\right )} a^{3} - 12 \,{\left (-i \, A - B\right )} a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 24 \,{\left (i \, A + B\right )} a^{3} \log \left (\tan \left (d x + c\right )\right ) + \frac{{\left (24 \, A - 18 i \, B\right )} a^{3} \tan \left (d x + c\right )^{2} + 3 \,{\left (-3 i \, A - B\right )} a^{3} \tan \left (d x + c\right ) - 2 \, A a^{3}}{\tan \left (d x + c\right )^{3}}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(6*(d*x + c)*(4*A - 4*I*B)*a^3 - 12*(-I*A - B)*a^3*log(tan(d*x + c)^2 + 1) - 24*(I*A + B)*a^3*log(tan(d*x
+ c)) + ((24*A - 18*I*B)*a^3*tan(d*x + c)^2 + 3*(-3*I*A - B)*a^3*tan(d*x + c) - 2*A*a^3)/tan(d*x + c)^3)/d

________________________________________________________________________________________

Fricas [A]  time = 1.38771, size = 504, normalized size = 3.76 \begin{align*} \frac{{\left (48 i \, A + 24 \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-66 i \, A - 42 \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (26 i \, A + 18 \, B\right )} a^{3} +{\left ({\left (-12 i \, A - 12 \, B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} +{\left (36 i \, A + 36 \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-36 i \, A - 36 \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (12 i \, A + 12 \, B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \,{\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/3*((48*I*A + 24*B)*a^3*e^(4*I*d*x + 4*I*c) + (-66*I*A - 42*B)*a^3*e^(2*I*d*x + 2*I*c) + (26*I*A + 18*B)*a^3
+ ((-12*I*A - 12*B)*a^3*e^(6*I*d*x + 6*I*c) + (36*I*A + 36*B)*a^3*e^(4*I*d*x + 4*I*c) + (-36*I*A - 36*B)*a^3*e
^(2*I*d*x + 2*I*c) + (12*I*A + 12*B)*a^3)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*I*c) - 3*d*e^(4*I*d*
x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) - d)

________________________________________________________________________________________

Sympy [A]  time = 14.52, size = 170, normalized size = 1.27 \begin{align*} - \frac{4 a^{3} \left (i A + B\right ) \log{\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac{\frac{\left (16 i A a^{3} + 8 B a^{3}\right ) e^{- 2 i c} e^{4 i d x}}{d} - \frac{\left (22 i A a^{3} + 14 B a^{3}\right ) e^{- 4 i c} e^{2 i d x}}{d} + \frac{\left (26 i A a^{3} + 18 B a^{3}\right ) e^{- 6 i c}}{3 d}}{e^{6 i d x} - 3 e^{- 2 i c} e^{4 i d x} + 3 e^{- 4 i c} e^{2 i d x} - e^{- 6 i c}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))**3*(A+B*tan(d*x+c)),x)

[Out]

-4*a**3*(I*A + B)*log(exp(2*I*d*x) - exp(-2*I*c))/d + ((16*I*A*a**3 + 8*B*a**3)*exp(-2*I*c)*exp(4*I*d*x)/d - (
22*I*A*a**3 + 14*B*a**3)*exp(-4*I*c)*exp(2*I*d*x)/d + (26*I*A*a**3 + 18*B*a**3)*exp(-6*I*c)/(3*d))/(exp(6*I*d*
x) - 3*exp(-2*I*c)*exp(4*I*d*x) + 3*exp(-4*I*c)*exp(2*I*d*x) - exp(-6*I*c))

________________________________________________________________________________________

Giac [B]  time = 1.71772, size = 344, normalized size = 2.57 \begin{align*} \frac{A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 9 i \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 3 \, B a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 51 \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 36 i \, B a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 192 \,{\left (-i \, A a^{3} - B a^{3}\right )} \log \left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + i\right ) - 96 \,{\left (i \, A a^{3} + B a^{3}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) - \frac{-176 i \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 176 \, B a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 51 \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 36 i \, B a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 9 i \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 3 \, B a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + A a^{3}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3}}}{24 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(A*a^3*tan(1/2*d*x + 1/2*c)^3 - 9*I*A*a^3*tan(1/2*d*x + 1/2*c)^2 - 3*B*a^3*tan(1/2*d*x + 1/2*c)^2 - 51*A*
a^3*tan(1/2*d*x + 1/2*c) + 36*I*B*a^3*tan(1/2*d*x + 1/2*c) - 192*(-I*A*a^3 - B*a^3)*log(tan(1/2*d*x + 1/2*c) +
 I) - 96*(I*A*a^3 + B*a^3)*log(abs(tan(1/2*d*x + 1/2*c))) - (-176*I*A*a^3*tan(1/2*d*x + 1/2*c)^3 - 176*B*a^3*t
an(1/2*d*x + 1/2*c)^3 - 51*A*a^3*tan(1/2*d*x + 1/2*c)^2 + 36*I*B*a^3*tan(1/2*d*x + 1/2*c)^2 + 9*I*A*a^3*tan(1/
2*d*x + 1/2*c) + 3*B*a^3*tan(1/2*d*x + 1/2*c) + A*a^3)/tan(1/2*d*x + 1/2*c)^3)/d